package patterns.statePattern;

import java.util.HashMap;
import java.util.Map;

public class TrafficLightFactory {
	private static Map<String, TrafficLights> singleEntityMapper;

	public static TrafficLights newInstance(String address, State beginState, Map<State, Integer>[] stateTimeMapper,Map<String, State> walkmanPassingState) {
		if (singleEntityMapper == null) {
			singleEntityMapper = new HashMap<>();
		}
		if (singleEntityMapper.get(address) == null) {
			TrafficLights.getInstance(address, beginState, stateTimeMapper,walkmanPassingState, singleEntityMapper);
		}
		return singleEntityMapper.get(address);
	}
}
